"""消费者"""
import pika

#1、创建证书
credentials = pika.PlainCredentials("admin","123456Aa")

#2、连接MQ服务器
conn_param = pika.ConnectionParameters("192.168.10.161",credentials=credentials)
mq_conn = pika.BlockingConnection(conn_param)

#3、创建通道
mq_channel = mq_conn.channel()

#4、通道取名
mq_channel.queue_declare(queue="jzc")

#5、读取消息
def callback(ch,method,properties,body):
    print(body.decode())

mq_channel.basic_consume(queue="jzc",on_message_callback=callback,auto_ack=True)

#6、进入持续监听，处理消息
mq_channel.start_consuming()

